You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Image Library

Appendix B

Deprecated API Functions and API Behavior

Related Topics

Image Library

Platform Library

Platform Library

Requested API Level

B.1 Image Library

Before platform.apiLevel = '2.3', images were encoded as strings within the script itself. Only the TI-Nspire™ Script Editor of the software version 3.2 supports authoring images encoded as strings inside the script itself.

The following provides details about the encoding.

The header consists of 20 bytes of data arranged as presented in the following table. All elds are little endian integers.

Offset

Width (bytes)

Contents

0

4

Pixel width of image

4

4

Pixel height of image

8

1

Image alignment (0)

9

1

Flags (0)

10

2

Pad (0)

12

4

The number of bytes between successive raster lines

16

2

The number of bits per pixel (16)

18

2

Planes per bit (1)

The image pixel data immediately follows the header. Pixels are arranged in rows. Each pixel is a little endian 16-bit integer with ve bits for each color red, green, and blue. The top bit determines if the pixel is drawn. If it is zero (0), the pixel is not drawn. If it is one (1), the pixel is drawn in the RGB color of the remaining 15 bits.

0x8000 is black, 0x801F is blue, 0x83E0 is green, 0xFC00 is red, and 0xFFFF is white.

B.2 Platform Library

B.2.1 gc

platform.gc()

This function has been replaced by platform.withGC(), but if you want to author or modify scripts with platform.apiLevel = '1.0' you still need this function.

This graphics context should not be used for drawing purposes because it is not guaranteed to be associated with a window.

Listing B.1 shows an example of using the static graphics context to get the string width and height.

Listing B.1: Use of the static GC in platform.apiLevel = '1.0'

local gc = platform.gc()
gc:setFont('serif', 'r', 10)
local width = gc:getStringWidth(a_string)
local height = gc:getStringHeight(a_string)

Introduced in platform.apiLevel = '1.0'

Removed in platform.apiLevel = '2.0'

B.3 Platform Library

B.3.1 drawString Vertical Alignment

gc:drawString("text", x, y [, vertalignment])

Prior to platform.apiLevel = '2.3', “none” was used to specify unspecified vertical alignment. The vertical alignment “none” has been deprecated. Specifying no alignment defaults to “top” and so does “none”.

Introduced in platform.apiLevel = '1.0'

Extended in platform.apiLevel = ‘2.3’

B.4 Requested API Level

Prior to TI-Nspire™ software version 3.6 (platform.apiLevel = '2.3'), requesting a
non-supported API level resulted in the highest API level supported by the TI-Nspire™ software version used to run the script. This behavior has been revised. See section 14.1 for details about the new revised behavior.

Introduced in platform.apiLevel = '2.0'

Extended in platform.apiLevel = ‘2.3’